package com.jiuyin.dianjing.api.interfaces;


import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.jiuyin.dianjing.api.data.BasicResponse;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Url;

import static com.jiuyin.dianjing.api.constant.ApiConstant.KEY_DATA;

/**
 * @author Administrator
 * @date 2018/1/15
 */

public interface ApiInterface {
    @POST()
    Observable<BasicResponse<JsonObject>> postObserveBasicJson(@Url String url, @Body RequestBody requestBody);

    //上传文件和Json
    @Multipart
    @POST()
    Observable<BasicResponse<JsonObject>> postObserveJsonAndFile(@Url String url, @Part(KEY_DATA) RequestBody body, @Part MultipartBody.Part file);

    @POST()
    Observable<BasicResponse<JsonArray>> postObserveJsonArray(@Url String url, @Body RequestBody requestBody);

    @GET()
    Observable<BasicResponse<String>> getObserveBasicStr(@Url String url);

    @PUT()
    Observable<BasicResponse<JsonArray>> putObserveJsonArray(@Url String url, @Body RequestBody requestBody);

    @POST()
    Observable<BasicResponse<String>> postObserveJson(@Url String url, @Body RequestBody requestBody);

    //没有请求体的post
    @POST()
    Observable<BasicResponse<String>> postObserveJson(@Url String url);
}